let storage = {
    set: (key, value) => {
        localStorage.setItem(key, value);
    },
    get: (key) => {
        return localStorage.getItem(key);
    },
    del: (key) => {
        localStorage.removeItem(key);
    },
    clear: () => {
        localStorage.clear();
    }
};
let session = {
    set: (key, value) => {
        sessionStorage.setItem(key, value);
    },
    get: (key) => {
        return sessionStorage.getItem(key);
    },
    del: (key) => {
        sessionStorage.removeItem(key);
    },
    clear: () => {
        sessionStorage.clear();
    }
};

const install = function (Vue, options) {
    if (install.installed) return;
    Vue.prototype.$storage = storage;
    Vue.prototype.$session = session;
};

if (typeof window !== 'undefined' && window.Vue) {
    install(window.Vue);
}

module.exports = {
    version: '1.0.0',
    install,
    storage: storage,
    session: session
};
